
import platform
import subprocess


def judge_platform(func):
    def inner(*args,**kwargs):
        if platform.system() == "Linux":
            print("不能执行")
        elif platform.system() == "Windows":
            return func(*args, **kwargs)
    return inner


@judge_platform
def ping(ip_list):
    for i in ip_list:
        p = subprocess.Popen("ping "+i,
                             stdout=subprocess.PIPE,
                             stdin=subprocess.PIPE,
                             stderr=subprocess.PIPE,
                             shell=True,
                             encoding='gbk')
        p.wait()
        print(p.stdout.read())

ip_list = ['10.110.86.' + str(i) for i in range(1, 255)]

ping(ip_list)

